# tool.py 工具示例，在这里定义你的工具

# |tidy_agent_chat
# |  |__agent.py
# |  |__channel.py
# |  |__config_loader.py
# |  |__logger.py
# |  |__message.py
# |  |__...
# |tool.py

from dataclasses import dataclass
from fastmcp import FastMCP
from tidy_agent_chat.logger import get_logger
from typing import Optional, Literal
import json

# 创建日志器
logger = get_logger(__name__)

mcp = FastMCP("My Tool Server", port=8000)
    

####################
# 在这里定义你的工具
####################
@mcp.tool(description="查询药物的相关信息")
def get_drug_dsp(drug: str) -> dict:
    """获取指定药物的相关信息"""
    return {"drug": drug, "dsp": "治疗感冒。"}

@mcp.tool(description="查询相关病历")
def get_case(key_word: str) -> dict:
    """获取相关病例"""
    return {"key_word": key_word, "case": "他感冒了。"}

@mcp.tool(description="查询HPO记录")
def get_hpo(key_word: str) -> dict:
    """获取相关hpo"""
    return {"key_word": key_word, "HPO": "这是相关HPO的示例描述。"}

@mcp.tool(description="查询天气")
def get_weather(city: str, time: Optional[Literal["now", "tomorrow"]] = None) -> dict:
    """获取指定城市的天气"""
    if time:
        return {"city": city, "time": time, "weather": "下雨。"}
    return {"city": city, "weather": "天气晴朗。"}


if __name__ == "__main__":
    mcp.run(
        transport="http",
        host="127.0.0.1",
        port=8000,
        path="/mcp",
        log_level="debug",
    ) 